package com.aaa.pay.controller;

import com.aaa.pay.service.AccountOrderService;
import com.aaa.vo.AccountOrderVo;
import com.aaa.vo.MqVo;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author JYH
 * @version 1.0
 * @date 2023/3/6 10:13
 */
@Api(value = "/pay/WXPay", tags = {"微信支付"})
@RestController
@RequestMapping("/pay/WXPay")
public class AccountOrderController {

    @Autowired
    private AccountOrderService accountOrderService;

    /**
     * @author JYH
     * @date 2023/3/6 14:28
     * @description - 接收微信支付返回的路径
     * @param accountOrderVo
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "AccountOrderVo", name = "accountOrderVo", value = "", required = true)
    })
    @ApiOperation(value = "- 接收微信支付返回的路径", notes = "- 接收微信支付返回的路径", httpMethod = "POST")
    @PostMapping("/createNative")
    public Result createNative(@RequestBody AccountOrderVo accountOrderVo){
        return accountOrderService.createNative(accountOrderVo);
    }
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "MqVo", name = "mqVo", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @PostMapping("/createMQ")
    public Result createMQ(@RequestBody MqVo mqVo){
        return accountOrderService.createMQ(mqVo.getId());
    }

    /**
     * @author JYH
     * @date 2023/3/9 10:55
     * @description - 未支付订单的支付
     * @param accountOrderVo
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "AccountOrderVo", name = "accountOrderVo", value = "", required = true)
    })
    @ApiOperation(value = "- 未支付订单的支付", notes = "- 未支付订单的支付", httpMethod = "POST")
    @PostMapping("/createNative1")
    public Result createNative1(@RequestBody AccountOrderVo accountOrderVo){
        return accountOrderService.createNative1(accountOrderVo);
    }
    /**
     * @author JYH
     * @date 2023/3/6 14:28
     * @description - 修改支付订单状态码
     * @param id
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "id", value = "", required = true)
    })
    @ApiOperation(value = "- 修改支付订单状态码", notes = "- 修改支付订单状态码", httpMethod = "POST")
    @PostMapping("/queryPayStatus")
    public Result queryPayStatus(Integer id){
        return accountOrderService.queryPayStatus(id);
    }

    /**
     * @author JYH
     * @date 2023/3/6 15:41
     * @description - 修改账户余额，积分
     * @param accountOrderVo
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "AccountOrderVo", name = "accountOrderVo", value = "", required = true)
    })
    @ApiOperation(value = "- 修改账户余额，积分", notes = "- 修改账户余额，积分", httpMethod = "POST")
    @PostMapping("/addMoney")
    public Result addMoney(@RequestBody AccountOrderVo accountOrderVo){
        return accountOrderService.addMoney(accountOrderVo);
    }
}
